<!--管理员=》商家列表-->
<template>
	<div>
	  <MainContent>
		 <div class="content_title">
		 	<span style="color: #222222;font-size: 24px;font-weight: 400;">{{title}}</span>
		</div>
		 <div class="table_content">
		 	<el-row>
		 		<div style="display: flex;justify-content: space-between;align-items: center;">
				  <el-input
				    placeholder="请输入用户名或用户编号"
						style="width:320px;"
				    v-model="UserInput">
						<el-button slot="append" icon="el-icon-search" @click="SearchUser"></el-button>
				  </el-input>
			   </div>
			   <el-table
		        ref="multipleTable"
		        :data="userListData"
		        style='width: 99%;margin-top: 50px;'
		        tooltip-effect="dark">
		        <el-table-column
		          align="center"
		          type='index'
		          label="#">
		        </el-table-column>
		        <el-table-column
		          align="center"
		          prop="Name"
		          label="用户昵称">
		        </el-table-column>
		        <el-table-column
		          align="center"
		          prop="UserNo"
		          label="用户编码">
		        </el-table-column>
		        <el-table-column
		          align="center"
		          prop="Score"
		          label="淘气值">
		        </el-table-column>
		       	<el-table-column
		          align="center"
		          width='140'
		          label="认证图片">
		          <template slot-scope="scope">
		          	<el-row :gutter='30' style="display: flex;justify-content: center;width: 100%;align-items: center;"> 
						<el-col :lg='12'><img @click="lookDetail(scope.row.AuthImage1)" :src="scope.row.AuthImage1"  width="55px" height="39px"/></el-col>
						<el-col :lg='12'><img @click="lookDetail(scope.row.AuthImage2)" :src="scope.row.AuthImage2" width="55px" height="39px"/></el-col>
		          	</el-row>
				   </template>
		        </el-table-column>
		        <el-table-column
		          align="center"
		          label="操作">
		          <template slot-scope="scope">

				        <el-button 
				        	type='danger'
				        	size='mini' 
									@click="passFalse(scope.$index, scope.row)">不通过</el-button>
				        <el-button 
				              size="mini"
				              type='primary'
				              @click="passTrue(scope.$index, scope.row)">通过</el-button>
				   </template>
		        </el-table-column>
		     </el-table>
		 	</el-row>
		 </div>
		 <el-dialog :visible.sync="lookOpen" width='50%'>
		 	<div style="width: 100%;text-align: center;">
		 		<img :src="lookUrl"  width="100%" height="100%"/>
		 	</div>
		</el-dialog>
      </MainContent>
   </div>
</template>
<script>
	import MainContent from '../components/main_content'
	import global from './global'
	export default {
    name: "UserManage",
    inject:['reload'],
    mounted(){
    	this.initData();
    },
    data() {
    	return {
    		title: '淘宝认证审核',
    		userListData: [],
    		goDownShow: false,
    		ifSubmit: false,
    		userGoDownId: '',
    		goDownDay: '',
    		lookOpen:false,
    		lookUrl:'',
			UserInput:"",
			checkResult: '',
			checkId:'',
    	}
    },
    components:{
    	MainContent
    },
    methods:{
    	initData(){
    		let _this = this;
    		global.$http({
						method:'get',
						url:global.urlAll+'CheckAuthUser/',
						headers:{
							'Content-Type':'application/x-www-form-urlencoded',
							'cache-control': 'no-cache, no-store',
							'Pragma': 'no-cache'
						},
						params:{
							KeyWord:_this.UserInput,
							Page: '1',
							Row: '6'
						}
					}).then((res)=>{
						if(res.data.success == 'true'){
							_this.userListData = res.data.data;
						}else{
							_this.$message(res.msg)
						}
					})
    	},
    	SearchUser(){
				let _this = this;
				this.initData();
    		
    	},
    	passTrue(index,row){
    		let _this = this;
    		this.$confirm('是否确认通过?', '提示', {
		         confirmButtonText: '确定',
		         cancelButtonText: '取消',
		         type: 'warning'
		       }).then(() => {
		       	this.checkResult = '1';
		       	this.checkId = row.Id;
		       	this.confirmSendResult();
		       })
    	},
    	passFalse(index,row){
    		let _this = this;
    		this.$confirm('是否确认不通过?', '提示', {
		         confirmButtonText: '确定',
		         cancelButtonText: '取消',
		         type: 'warning'
		       }).then(() => {
		       	this.checkResult = '2';
		       	this.checkId = row.Id;
		       	this.confirmSendResult();
		       })
    	},
    	lookDetail(path){
    		this.lookOpen = true;
    		this.lookUrl = path;
    	},
    	confirmSendResult(){
    		let _this = this;
    		global.$http({
						method:'get',
						url:global.urlAll+'GoCheck/',
						headers:{
							'Content-Type':'application/x-www-form-urlencoded',
							'cache-control': 'no-cache, no-store',
							'Pragma': 'no-cache'
						},
						params:{
							Status: _this.checkResult,
							AuthId: _this.checkId
						}
					}).then((res)=>{
						if(res.data.Success == 'true'){
							_this.$message('提交成功');
					       	this.checkResult = '';
					       	this.checkId = '';
					       	_this.initData();
						}else{
							_this.$message(res.msg)
						}
					})
    	}
    },
   }
	
	
</script>

<style scoped="scoped">
	.content_title {
	padding-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    
  }
  .table_content{
  	padding: 20px;
  	background: #FFFFFF;
  }
  table,tbody,thead {
	  width: 100% !important;
	}
	colgroup {
	  position: absolute;
	  width: 100% !important;
	  display: flex;
	}
	col {
	  flex: 1;
	  text-align: center;
	}
</style>